package mr

//
// RPC definitions.
//
// remember to capitalize all names.
//

import "os"
import "strconv"

//
// example to show how to declare the arguments
// and reply for an RPC.
//

const (
	FATAL   = 0
	SUCCESS = 1 
	FULL    = 2
)
// Add your RPC definitions here.
type ExampleArgs struct {
	X int
}

type ExampleReply struct {
	Y int
}

type RegisterArgs struct {
}

type RegisterReply struct {
	Id      int
	Success int
	Msg     string
	Data    RegisterData

}

type RegisterData struct {
	Member         int
	Heart_interval int
	Nreduce        int
}

type KeepAliveArgs struct {
	Id int
}

type KeepAliveReply struct {
	Success int
}

type GetTaskReq struct {
	WorkerId int
}

type GetTaskResp struct {
	Data Task
}

type CompleteTaskReq struct {
	Id int
	Kind TaskType
	Resources []string
	WorkerId int
	Member int
}

type CompleteTaskResp struct {
	Status int
}

type Task struct {
    Kind TaskType
	Member int
    Resources []string
}


// Cook up a unique-ish UNIX-domain socket name
// in /var/tmp, for the coordinator.
// Can't use the current directory since
// Athena AFS doesn't support UNIX-domain sockets.
func coordinatorSock() string {
	s := "/var/tmp/824-mr-"
	//数字转字符串  调用者的用户id
	s += strconv.Itoa(os.Getuid())
	return s
}
